﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MyWebApp.Web;
using System.Windows.Ria.Data;

namespace MyWebApp
{
    public partial class MainPage : UserControl
    {
        private ProductContext _productContext = new ProductContext();
        public MainPage()
        {
            InitializeComponent();

            // Get the query
            //LoadOperation<Product> loadOp =
            //    this._productContext.Load(this._productContext.GetProductQuery());

            // Set a different kind of query
            var query = from p in _productContext.GetProductQuery()
                        where p.ProductSubcategoryID == 1
                        select p;
            LoadOperation<Product> loadOp = _productContext.Load(query);

            this.TheDataGrid.ItemsSource = loadOp.Entities;


        }
    }
}
